﻿package mortal.game.proxy
{
    import Message.Game.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.mvc.core.*;

    public class ClosedBetaGiftBagProxy extends Proxy
    {
        private var _onlineTime:int = -1;
        private var _startDt:int = -1;
        private var _level:int = -1;

        public function ClosedBetaGiftBagProxy()
        {
            return;
        }// end function

        public function getOnlineReward(param1:int) : void
        {
            this._onlineTime = param1;
            rmi.iRolePrx.getAgencyReward_async(new AMI_IRole_getAgencyReward(this.onOnlineRewardTake), new EAgencyAwardType(2), param1);
            return;
        }// end function

        private function onOnlineRewardTake(param1:AMI_IRole_getAgencyReward) : void
        {
            if (this._onlineTime < 0)
            {
                return;
            }
            Dispatcher.dispatchEvent(new DataEvent(EventName.ClosedBetaOnlineGiftTake, this._onlineTime));
            this._onlineTime = -1;
            return;
        }// end function

        public function getTimingReward(param1:int) : void
        {
            this._startDt = param1;
            rmi.iRolePrx.getAgencyReward_async(new AMI_IRole_getAgencyReward(this.onTimingRewardTake), new EAgencyAwardType(3), 0);
            return;
        }// end function

        private function onTimingRewardTake(param1:AMI_IRole_getAgencyReward) : void
        {
            if (this._startDt < 0)
            {
                return;
            }
            Dispatcher.dispatchEvent(new DataEvent(EventName.ClosedBetaTimingGiftTake, this._startDt));
            this._startDt = -1;
            return;
        }// end function

        public function getLevelReward(param1:int) : void
        {
            this._level = param1;
            rmi.iRolePrx.getAgencyReward_async(new AMI_IRole_getAgencyReward(this.onLevelRewardTake), new EAgencyAwardType(1), param1);
            return;
        }// end function

        private function onLevelRewardTake(param1:AMI_IRole_getAgencyReward) : void
        {
            if (this._level < 0)
            {
                return;
            }
            Dispatcher.dispatchEvent(new DataEvent(EventName.ClosedBetaLevelGiftTake, this._level));
            this._level = -1;
            return;
        }// end function

    }
}
